package com.example.testapplication.binding.titleBar;

import android.animation.Animator;
import android.view.View;

import androidx.databinding.BindingAdapter;

import com.airbnb.lottie.LottieAnimationView;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;

import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class ViewAdapter {
    @BindingAdapter(value = {"onTitleBarRightCommand","onTitleBarLeftCommand"},requireAll = false)
    public static void onAnimationCommand(TitleBar view, final BindingCommand onTitleBarRightCommand,final BindingCommand onTitleBarLeftCommand){
        view.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View view) {
                if(onTitleBarLeftCommand!=null){
                    onTitleBarLeftCommand.execute();
                }
            }

            @Override
            public void onTitleClick(View view) {

            }

            @Override
            public void onRightClick(View view) {
                if(onTitleBarRightCommand!=null){
                    onTitleBarRightCommand.execute();
                }
            }
        });
    }
}
